<div id="msgBar_<{$widgets_id}>" class="my-msg">                              
    <a href="<{link app=b2c ctl=site_member act=inbox}>" >
      <span class="mti"></span>您有<span id="msg_num"></span>条未读消息
    </a>
  </div>
<!-- 链接到我的订单页面，2015-10-15，by liuxin -->
<!-- 右上角导航栏，在某个页面时，对应的导航链接样式改变，在线客服、帮助中心和网站导航暂时没有页面，所以没做，但是预留了参数，页面完成后将#换成最后一个"/"到".thml"之间的内容即可，2015-10-16，by liuixn -->
<a id='member-orders' href="<{link app=b2c ctl=site_member act=orders}>" class="fl">我的订单
    <span id='member-orders1'></span></a>
<span id='member-orders2' class="dividing fl"></span>
<a id='member' href="<{link app=b2c ctl=site_member act=index}>" class="fl">会员中心
    <span id='member1'></span></a>
<!-- <span id='member2' class="dividing fl"></span>
<a id='#' href="#" class="fl">在线客服
    <span id='#1'></span></a>-->
<!-- <span id='#2' class="dividing fl"></span> -->
<!-- <a id='#' href="../index.php/article-help-l-1.html" class="fl">帮助中心
    <span id='#1'></span></a> -->
<!-- <span id='#2' class="dividing fl"></span> -->
<!-- <a id='#' href="#" class="fl">网站导航
    <span id='#1'></span></a>
<span id='#2' class="dividing fl"></span>
<span id="cur_select_<{$widgets_id}>" class="fl cur_select">
    <span class="cur-name"></span>
</span>-->
<script>
    var e = Cookie.read('UNAME')?Cookie.read('UNAME'):'';
    if(e){
      new Request({
          url:'<{link app=b2c ctl=site_member act=get_unreadmsg_num}>',
          method:'post',
          onComplete:function(e){
            rs = parseInt(JSON.decode(e).inbox_num);
            $("msg_num").innerHTML = rs;
            if(rs > 0){
              $("msgBar_<{$widgets_id}>").setStyle('display','block');
            }else{
              $("msgBar_<{$widgets_id}>").setStyle('display','none');
            }
          }
        }).send();
    }
    else{
        $("msgBar_<{$widgets_id}>").setStyle('display','none');
    }
    var coinBar = $('cur_select_<{$widgets_id}>');
    var barOptions = {
        MID:Cookie.read('S[MEMBER]')?Cookie.read('S[MEMBER]'):'',
        coin:<{$data.cur|default:'null'}>,
        curCoin:Cookie.read('S[CUR]')?Cookie.read('S[CUR]'):'<{$data.def_cur.cur_code}>',
        cartViewURl:'<{link app=b2c ctl="site_cart" act="view"}>',
        stick:<{if $setting.stick}>true<{else}>false<{/if}>
    };
    if(coinBar){
        var coinMenu = new Element('div',{'class':'coinmenu fmenu','styles':{'display':'none'}}).inject(coinBar);
        barOptions.coin.each(function(item){
            if(item['cur_code']==barOptions['curCoin']){
                coinBar.getElement('.cur-name').set('text',[item.cur_sign,item.cur_name].join(''));
            }
            coinMenu.adopt(new Element('div',{'class':'item',text:[item.cur_sign,item.cur_name].join(''),events:{
                    click:function(){
                        Cookie.write('S[CUR]',item.cur_code,{path:"<{$data.base_url}>"});
                        if(item['cur_code'] != barOptions['curCoin']) {
                            new Request.JSON({
                                url:'<{link app=b2c ctl=site_cart act=getCartTotalPrice}>',
                                data:'currency='+item['cur_code'],
                                onSuccess:function(rs){
                                    Cookie.write('S[CART_TOTAL_PRICE]',rs,{path:"/"});
                                },
                                onComplete:function(){
                                    window.location.href=window.location.href;
                                }
                            }).send();
                        }
                        else{
                            window.location.href=window.location.href;
                        }
                    }
            }}));
        });
        coinBar.addEvents({
            'mouseenter':function(){
                coinMenu.setStyles({
                    display:'block',
                    visibility:'visible'
                });
            },
            'mouseleave':function(){
                coinMenu.setStyles({
                    visibility:'hidden'
                });
            }
        });
    }
    //处理右上角导航，在某个界面时，对应的导航按钮样式改变。2015-10-18，by liuxin
    var currentUrl = this.location.href;
    var aaa = currentUrl.slice(currentUrl.lastIndexOf('/')+1,-5);
    if(document.getElementById(aaa))
    {
        document.getElementById(aaa).className = "my-order";
        document.getElementById(aaa+'1').className = "ar";
        document.getElementById(aaa+'2').parentNode.removeChild(document.getElementById(aaa+'2'));
    }
</script>
